package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsMobileUserReadDao;
import com.party.core.dao.write.analysis.StatisticsMobileUserWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsMobileUser;
import com.party.core.service.analysis.IStatisticsMobileUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 手机端用户接口实现
 * @author: Huaqunhao
 * @create: 2018-08-01 15:40
 **/

@Service
public class StatisticsMobileUserService implements IStatisticsMobileUserService {

    @Autowired
    private StatisticsMobileUserReadDao statisticsMobileUserReadDao;
    @Autowired
    private StatisticsMobileUserWriteDao statisticsMobileUserWriteDao;
    
    @Override
    public String insert(StatisticsMobileUser statisticsMobileUser) {
        BaseModel.preInsert(statisticsMobileUser);
        boolean result = statisticsMobileUserWriteDao.insert(statisticsMobileUser);
        if (result){
            return statisticsMobileUser.getId();
        }
        return null;
    }

    @Override
    public boolean update(StatisticsMobileUser statisticsMobileUser) {
        statisticsMobileUser.setUpdateDate(new Date());
        return statisticsMobileUserWriteDao.update(statisticsMobileUser);
    }

    @Override
    public boolean deleteLogic(String id) {
        return statisticsMobileUserWriteDao.deleteLogic(id);
    }

    @Override
    public boolean delete(String id) {
        return statisticsMobileUserWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return statisticsMobileUserWriteDao.batchDeleteLogic(ids);
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return statisticsMobileUserWriteDao.batchDelete(ids);
    }

    @Override
    public StatisticsMobileUser get(String id) {
        return statisticsMobileUserReadDao.get(id);
    }

    @Override
    public List<StatisticsMobileUser> listPage(StatisticsMobileUser statisticsMobileUser, Page page) {
        return statisticsMobileUserReadDao.listPage(statisticsMobileUser,page);
    }

    @Override
    public List<StatisticsMobileUser> list(StatisticsMobileUser statisticsMobileUser) {
        return null;
    }

    @Override
    public List<StatisticsMobileUser> batchList(Set<String> ids, StatisticsMobileUser statisticsMobileUser, Page page) {
        return null;
    }

    @Override
    public StatisticsMobileUser getByUserId(String userId) {
        return statisticsMobileUserReadDao.getByUserId(userId);
    }
}
